<html>
    <head>
        <title><g:layoutTitle default="Grails" /></title>
        <link rel="stylesheet" href="${createLinkTo(dir:'css',file:'main.css')}" />
        <link rel="shortcut icon" href="${createLinkTo(dir:'images',file:'favicon.ico')}" type="image/x-icon" />
        <g:layoutHead />
        <g:javascript library="application" />				
    </head>
    <body>
        <table>
    	<tr>
    		<td>
		        <div id="spinner" class="spinner" style="display:none;">
		            <img src="${createLinkTo(dir:'images',file:'spinner.gif')}" alt="Spinner" />
		        </div>	
		        <div class="logo"><img src="${createLinkTo(dir:'images',file:'grails_logo.jpg')}" alt="Grails" /></div>
        	</td>
        	<td width="200px">
        		<g:if test="${session.user != null}">
	            <g:form controller="member" action="logout" method="post" >
	                <div class="dialog">
	                    <table>
	                        <tbody>
	                        
	                            <tr class="prop">
	                                <td valign="top" class="name">
	                                    <label for="login">Logged user:</label>
	                                </td>
	                                <td valign="top" class="value">
	                                    ${session?.user?.loginLdap}
	                                </td>
	                            </tr> 
	                        
	                        </tbody>
	                    </table>
	                </div>
	                <div class="buttons">
	                    <span class="button"><input class="save" type="submit" value="Logout" /></span>
	                </div>
	            </g:form>
	            </g:if>
	            <g:else>
	                 <g:form controller="member" action="doLogin" method="post" >
		                <div class="dialog">
		                    <table width="30%">
		                        <tbody>
		                        
		                            <tr class="prop">
		                                <td valign="top" class="name">
		                                    <label for="login">Login:</label>
		                                </td>
		                                <td valign="top" class="value ${hasErrors(bean:member,field:'loginLdap','errors')}">
		                                    <input type="text" id="login" name="login" value="${fieldValue(bean:member,field:'loginLdap')}"/>
		                                </td>
		                                <td valign="top" class="name">
		                                    <label for="password">Password:</label>
		                                </td>
		                                <td valign="top" class="value ${hasErrors(bean:member,field:'passwordLdap','errors')}">
		                                    <input type="password" id="password" name="password" value="${fieldValue(bean:member,field:'passwordLdap')}"/>
		                                </td>
		                            </tr>  
		                        
		                        </tbody>
		                    </table>
		                </div>
		                <div class="buttons">
		                    <span class="button"><input class="save" type="submit" value="Login" /></span>
		                </div>
		            </g:form>
	            </g:else>
	        </td>
	    </tr>
	    </table>	
        <g:layoutBody />		
    </body>	
</html>